const Router = require('koa-router')
const orderDao = require('../dao/orderDao')
const router = new Router();

router.get('/order/:uId' , async (ctx) => {
  const { uId } = ctx.params;
  ctx.body = await orderDao.getByUId(uId)
}) 

//用户id、书id、收件人、地址、电话号码、订单数量
router.get('/order/:uId/:bookId/:consignee/:addr/:phone/:count' , async (ctx) => {
  const { uId , bookId , consignee , addr , phone , count } = ctx.params;
  ctx.body = await orderDao.insertOrder(uId , bookId , consignee , addr , phone , count)
})

module.exports = router;